<script setup lang="ts">
import { useRouter } from "vue-router";
import { watch } from "vue";
import { useCommpnStore } from "@/stores/common";
import { getAllDict } from "@/utils/utils";
import { onMounted } from "vue";
const useStore = useCommpnStore();
const router = useRouter();
onMounted(() => {
    getAllDict("share_type,blog_type,blog_tag,collect_type");

    window.addEventListener('resize', () => {
        let width = document.body.clientWidth;
        useStore.changePageWidth(width)
    });

});
watch(
    () => router.currentRoute.value.path,
    (newRouter) => {
        useStore.setRouter(router.currentRoute.value);
        window.scrollTo({
            top: 0,
            behavior: "smooth", // 可选，平滑滚动效果
        });
    }
);

// 一个计算属性 ref
</script>
<template>
    <router-view></router-view>
</template>
